//package com.indexingsystem.system.websocket;
//
//
//import java.io.IOException;
//import java.util.UUID;
//
//import javax.annotation.Resource;
//
//import org.codehaus.jackson.JsonGenerationException;
//import org.codehaus.jackson.map.JsonMappingException;
//import org.codehaus.jackson.map.ObjectMapper;
//import org.springframework.amqp.AmqpException;
//import org.springframework.amqp.core.Message;
//import org.springframework.amqp.core.MessageBuilder;
//import org.springframework.amqp.core.MessageProperties;
//import org.springframework.amqp.rabbit.connection.ConnectionFactory;
//import org.springframework.amqp.rabbit.core.RabbitTemplate;
//import org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback;
//import org.springframework.amqp.rabbit.support.CorrelationData;
//import org.springframework.beans.factory.annotation.Autowired;
//
//import com.alibaba.fastjson.JSON;
// 
//public class RmqProducer implements ConfirmCallback{
// 
//	private RabbitTemplate template;
//	
//	public void convertAndSend(String routingKey, Object object) throws AmqpException, JsonGenerationException, JsonMappingException, IOException {
//		
//		 String orderJson = JSON.toJSONString(object);
//	     CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
//     	template.convertAndSend("spring-exchange", "spring-boot-routingKey",orderJson,correlationId);
//		
//	}
//
//	@Autowired
//	public RmqProducer(RabbitTemplate template){
//		this.template = template;
//	}
//	
//   
//    public void sendMessage(String content) {
//        try {
//        	CorrelationData correlationId = new CorrelationData(UUID.randomUUID().toString());
//        	template.convertAndSend("spring-exchange", "spring-boot-routingKey",content,correlationId);
//        } catch (Exception e) {
//        	e.printStackTrace();
//        }
//    }
// 
//	@Override
//	public void confirm(CorrelationData correlationData, boolean ack) {
//		System.out.println(" 回调id:" + correlationData+"ack:"+ack);  
//	}
//	
//	
//	
//}
